import { ChangeDetectionStrategy, Component, ElementRef } from '@angular/core'

@Component({
  selector: 'ad-cell-container',
  templateUrl: './ag-cell-container.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
  host: {
    '(click)': 'clickHandle($event)',
    '[class.ad-cell-container]': 'true',
  },
})
export class AdCellContainerComponent {
  constructor(private el: ElementRef) {}
  /**
   * 防止单元格点击事件传播
   */
  clickHandle(event) {
    if (
      event.target !== this.el.nativeElement &&
      window.getComputedStyle(event.target, null)?.cursor !== 'default'
    ) {
      event.stopPropagation()
    }
  }
}
